Having read a bit of the next chapter and discovered the zipWith function, I now have a higher-order non-recursive solution to the makeChange problem, viz. makeChange1 :: Int -> [Int] -> [Int] makeChange1 amt vs = zipWith div modvs vs where modvs = scanl mod amt vs
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed